import axios from '~/plugins/axios';

import * as types from '../../mutation-types/keyword/index';

export const getKeywordsList = function ({
    commit,
    state
}, preload) {
    return axios.get(process.env.baseUrl + '/keyword/getKeywordsList', {
        params: preload || {}
    })
};

export const addKeywords = function ({
    commit,
    state
}, preload) {
    return axios.post(process.env.baseUrl + '/keyword/addKeywords', preload || {})
};

export const updateKeyword = function ({
    commit,
    state
}, preload) {
    return axios.post(process.env.baseUrl + '/keyword/updateKeyword', preload || {})
};

export const deleteKeyword = function ({
    commit,
    state
}, preload) {
    return axios.post(process.env.baseUrl + '/keyword/deleteKeyword', preload || {})
};

export const getKeywordDetail = function ({
    commit,
    state
}, preload) {
    return axios.get(process.env.baseUrl + '/keyword/getKeywordDetail', {
        params: preload || {}
    })
};

export const getListByName = function ({
    commit,
    state
}, preload) {
    return axios.get(process.env.baseUrl + '/keyword/getListByName', {
        params: preload || {}
    })
};

export const getKeywordLog = function ({
    commit,
    state
}, preload) {
    return axios.get(process.env.baseUrl + '/keyword/getKeywordLog', {
        params: preload || {}
    })
};

export const varify = function ({
    commit,
    state
}, preload) {
    return axios.post(process.env.baseUrl + '/keyword/varify', preload || {})
};

export const uploadFileKey = function ({
    commit,
    state
}, preload) {
    return axios.post(process.env.baseUrl + '/keywords/importKeywords', preload || {})
};

export const getSelfBrandsListchu = function ({
    commit,
    state
}, preload) {
    return axios.get(process.env.baseUrl + '/sauronBrand/getSelfBrandsListforOperation', {
        params: preload || {}
    })
};